const generateGradientColors = (count:any) => {
  const baseColors = [
    ["#4facfe", "#00f2fe"], // 蓝-青渐变
    ["#ff758c", "#ff7eb3"], // 粉-玫红渐变
    ["#6a11cb", "#2575fc"], // 紫-蓝渐变
    ["#f83600", "#f9d423"], // 橙-黄渐变
    ["#43e97b", "#38f9d7"], // 绿-青渐变
    ["#ff0844", "#ffb199"], // 红-橙渐变
  ];

  return baseColors.slice(0, count).map((color) => ({
    type: "linear",
    x: 0,
    y: 0,
    x2: 0,
    y2: 1,
    colorStops: [
      { offset: 0, color: color[0] },
      { offset: 1, color: color[1] },
    ],
  }));
};
export const ringSerie = {
  name: "Access From",
  type: "pie",
  radius: ["40%", "70%"],
  avoidLabelOverlap: false,
  itemStyle: {
    borderRadius: 10,
    borderColor: "#fff",
    borderWidth: 2,
  },
  label: {
    show: false,
    position: "center",
  },
  emphasis: {
    label: {
      show: true,
      fontSize: 40,
      fontWeight: "bold",
    },
  },
  labelLine: {
    show: false,
  },
};
export const lineSerie = {
  type: "bar",
  barWidth: "60%",
  barMaxWidth: 30,
  itemStyle: {
    color: (params:any) => generateGradientColors(6)[params.dataIndex % 6],
    borderRadius: [4, 4, 0, 0],
    borderWidth: 0,
    shadowColor: "rgba(0, 217, 255, 0.3)",
    shadowBlur: 8,
    shadowOffsetY: 2,
  },
  emphasis: {
    itemStyle: {
      shadowColor: "rgba(0, 217, 255, 0.5)",
      shadowBlur: 10,
    },
  },
  label: {
    show: true,
    position: "top",
    color: "#fff",
    fontWeight: "bold",
    formatter: "{c}",
  },
};